#!/usr/bin/env python
#-*- coding:utf-8 -*-

import os
import sys
import string
import time

def ISOString2Time(s):
    '''
    convert a ISO format time to second
    from:20060412 16:46:40 to:23123123
    '''
    return time.mktime(time.strptime(s, '%Y%m%d %X'))

def ISOString2Time_2(s):
    '''
    convert a ISO format time to second
    from:2006-04-12 16:46:40 to:23123123
    '''
    return time.mktime(time.strptime(s, '%Y-%m-%d %X'))

def main():
    lasttime = ' 23:59:59'
    timeStr1 = sys.argv[1] + lasttime
    time1 = ISOString2Time(timeStr1)
    time2 = time1 - 24 * 60 * 60
    print "%s = %d" % (timeStr1, time1)
    print "from %d to %d" % (time2, time1)

if __name__ == '__main__':
    main()


